package com.wk.slaveNodes;

import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.SynchronousQueue;

import com.wk.job.Job;

public class PutToCalculating implements Runnable{
	LinkedBlockingQueue<Job> jobs = null;
	SynchronousQueue<Job> calculatingAJob = null;
	boolean isWorking = true;
	public PutToCalculating(LinkedBlockingQueue<Job> jobs,
			SynchronousQueue<Job> calculatingAJob) {
		this.jobs = jobs;
		this.calculatingAJob = calculatingAJob;
	}
	
	@Override
	public void run() {
		
		while(isWorking){
			try {
				System.out.println("等待计算一个job。。。");
				Job job = jobs.take();
				calculatingAJob.put(job);
				System.out.println("准备计算："+job);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		
	}

}
